#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_exercise1.py
# author:wmf
# datetime:2021/3/8 14:43
# software: PyCharm
'''
this is function description
'''
# import module your need


#定义一下变量：
#movie='流浪地球'
#ticket=45.9
#count=15
#total=ticket*count
#编程序输出以下效果：

movie = '流浪地球'
ticket = 45.9
count = 15
total = ticket*count

print('电影:%s'%movie)
print('人数:%d'%count)
print('单价:%f'%ticket)
print('单价:%.1f'%total)

message = '''
电影:%s
人数:%d
单价:%f
总价:%.1f
'''%(movie,count,ticket,total)

print(message)



#定义一个字符串, 分别进行查找某个字符串是否包含在这个字符串里面;
#进行某个字符串的替换;
#打印字符串的长度;

str1 = 'i like python'
str2 = 'like'
str3 = ' dont '

print(str1.find(str2,0,len(str1)))
print(str1.replace(' ',str3,1))
print(len(str1))

print('\n')

#定义一个列表,表示一个同学的学号,姓名,班级,3门课的分数;
#stu=['101','张三','软件1801',[80,89,65]]
#然后格式化打印输出一下；
stu = ['101','张三','软件1801',[80,89,65]]

print('学号:%s'%stu[0])
print('姓名:%s'%stu[1])
print('班级:%s'%stu[2])
print('成绩:%d'%stu[3][0],end=",")
print('%d'%stu[3][1],end=",")
print('%d'%stu[3][2])

print('\n')

#用列表定义10个同学的成绩,输出最高分,最低分,总分和平均值;

from random import randint

score = [randint(60,100) for _ in range(10)]
max_score = max(score)
min_score = min(score)
print(score)
print('最高分:%d'%max_score)
print('最低分:%d'%min_score)

total_score = 0

for i in score:
    total_score += i

print('总分:%d'%total_score)
# print(sum(score))
print('平均分:%d'%(total_score/10))

print('\n')

#输入5个同学的成绩,进行排序输出;进行添加新的数据操作;

score1 = [randint(60,100) for _ in range(5)]
print(score1)
score1.sort()
print(score1)
for i in score:
    score1.append(i)
print(score1)